/**
 * 版权所有(C)，上海勾芒信息科技，2017，所有权利保留。
 * 
 * 项目名：	cards-web
 * 文件名：	MemberInfo.java
 * 模块说明：	
 * 修改历史：
 * 2017年4月4日 - Debenson - 创建。
 */
package me.chanjar.weixin.mp.bean.card;

import java.io.Serializable;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * 会员卡的会员信息
 * 
 * @author Debenson
 * @since 0.1
 */
public class MemberInfo implements Serializable {
  private static final long serialVersionUID = -9149970468748385418L;

  /** 用户在本公众号内唯一识别码 */
  @JsonProperty("openid")
  private String openId;
  /** 用户昵称 */
  private String nickname;
  /** 会员卡号 */
  @JsonProperty("membership_number")
  private String membershipNumber;
  /** 积分信息 */
  private Integer bonus;
  /** 余额信息 */
  private Integer balance;
  /** 性别，取值 ：MALE, FEMALE */
  private String sex;
  /** 用户信息 */
  @JsonProperty("user_info")
  private UserInfo userInfo;
  /** 当前用户的会员卡状态 */
  @JsonProperty("user_card_status")
  private UserCardStatus userCardStatus;
  /** 该卡是否已经被激活，true表示已经被激活，false表示未被激活 */
  @JsonProperty("has_active")
  private Boolean hasActive;

  public String getOpenId() {
    return openId;
  }

  public void setOpenId(String openId) {
    this.openId = openId;
  }

  public String getNickname() {
    return nickname;
  }

  public void setNickname(String nickname) {
    this.nickname = nickname;
  }

  public String getMembershipNumber() {
    return membershipNumber;
  }

  public void setMembershipNumber(String membershipNumber) {
    this.membershipNumber = membershipNumber;
  }

  public Integer getBonus() {
    return bonus;
  }

  public void setBonus(Integer bonus) {
    this.bonus = bonus;
  }

  public Integer getBalance() {
    return balance;
  }

  public void setBalance(Integer balance) {
    this.balance = balance;
  }

  public String getSex() {
    return sex;
  }

  public void setSex(String sex) {
    this.sex = sex;
  }

  public UserInfo getUserInfo() {
    return userInfo;
  }

  public void setUserInfo(UserInfo userInfo) {
    this.userInfo = userInfo;
  }

  public UserCardStatus getUserCardStatus() {
    return userCardStatus;
  }

  public void setUserCardStatus(UserCardStatus userCardStatus) {
    this.userCardStatus = userCardStatus;
  }

  public Boolean getHasActive() {
    return hasActive;
  }

  public void setHasActive(Boolean hasActive) {
    this.hasActive = hasActive;
  }

  /**
   * 会员信息
   * 
   * @author Debenson
   * @since 0.1
   */
  public static class UserInfo implements Serializable {
    private static final long serialVersionUID = -7569908319675638166L;

    @JsonProperty("common_field_list")
    private List<NameValue> commonFields;

    @JsonProperty("custom_field_list")
    private List<NameValue> customFields;

    public List<NameValue> getCommonFields() {
      return commonFields;
    }

    public void setCommonFields(List<NameValue> commonFields) {
      this.commonFields = commonFields;
    }

    public List<NameValue> getCustomFields() {
      return customFields;
    }

    public void setCustomFields(List<NameValue> customFields) {
      this.customFields = customFields;
    }

  }

  /**
   * NAME + VALUE + VALUES
   * 
   * @author Debenson
   * @since 0.1
   */
  public static class NameValue implements Serializable {
    private static final long serialVersionUID = -5634758089719727217L;

    private String name;
    private String value;
    @JsonProperty("value_list")
    private List<String> values;

    public String getName() {
      return name;
    }

    public void setName(String name) {
      this.name = name;
    }

    public String getValue() {
      return value;
    }

    public void setValue(String value) {
      this.value = value;
    }

    public List<String> getValues() {
      return values;
    }

    public void setValues(List<String> values) {
      this.values = values;
    }

  }

  /**
   * 当前用户的会员卡状态
   * 
   * @author Debenson
   * @since 0.1
   */
  public static enum UserCardStatus {
    NORMAL, // 正常
    EXPIRE, // 已过期
    GIFTING, // 转赠中
    GIFT_SUCC, // 转赠成功
    GIFT_TIMEOUT, // 转赠超时
    DELETE, // 已删除，
    UNAVAILABLE,// 已失效
  }
}
